package demo;



interface IShape{
    int a = 10;//接口中的成员变量默认都是public static final
    public static final int b = 20;
    void drow();//接口中的方法默认都是abstract修饰的
    //abstract void  drow2();
}
class Cycle implements IShape{
    @Override
    public void drow() {
        System.out.println("画一个圆圈！");
    }
}

class Dog implements IShape{
    @Override
    public void drow() {
        System.out.println("画一只狗！");
    }
}

class Cat implements IShape{
    @Override
    public void drow() {
        System.out.println("画一只猫！");
    }
}
public class Test {
    public static void main1(String[] args) {
        Cycle cycle = new Cycle();
        Dog dog= new Dog();
        Cat cat = new Cat();
        //这里的IShape就相当于抽象类中的父类，写成一个引用类型的数组
        IShape[] shape = {cycle,dog,cat};
        for (int i = 0; i < shape.length; i++) {
            shape[i].drow();
        }
    }
}
